package xj.graph2d.template;

import java.util.Map;

import xj.graph2d.DrawShape;
import xj.graph2d.DrawShapeConstants;
import xj.graph2d.TextShape;
import xj.graph2d.shapes.RectangularShape;
import xj.graph2d.shapes.ShapeConstants;
import xj.graph2d.template.uml.UMLSystemModelListener;
import xj.model.uml.UMLSystem;

public class UMLDeploymentDiagramTemplate extends UMLTemplate {

  // UseCase Diagram

  public UMLDeploymentDiagramTemplate() {
  }

  @Override
  public void makeTemplate(Map iconMap) {

    // system
    addSystemTemplate("System");

  }

  protected void addSystemTemplate(String tempName) {
    DrawShape iconShape = new RectangularShape(ShapeConstants.DBOX_SHAPE,
	ShapeConstants.NORTH, 0, 0, 100, 70);
    setNodeAttr(iconShape);
    setNodeBgColor(iconShape, SYSTEM_BG);

    RectangularShape shape = new RectangularShape(ShapeConstants.DBOX_SHAPE,
	ShapeConstants.NORTH, 0, 0, 100, 70);
    setNodeAttr(shape);
    setNodeBgColor(shape, SYSTEM_BG);
    TextShape text = makeTitleText("System");
    shape.setLabel(DrawShapeConstants.ROLE_NODE_LABEL, text);
    shape.setAcceptSubshape(false);
    shape.setScaleMode(DrawShapeConstants.SCALE_EXCLUDE_SUBSHAPE);

    shape.setModel(new UMLSystem());
    shape.setModelListener(new UMLSystemModelListener());

    add(new TemplateToolButton("System", shape, iconShape, 24, 24, false, true));
  }

  // system style
  public static final String SYSTEM_BG = "template.UMLDeploymentDiagram.System.bg";

  public static final String SYSTEM_FONT = "template.UMLDeploymentDiagram.System.font";

  public static final String SYSTEM_COLOR = "template.UMLDeploymentDiagram.System.color";

}
